﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="seller_product_add.aspx.cs" Inherits="product_add" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <style type="text/css">
 
    </style>
<script language="javascript" type="text/javascript">
  function checkType(){
    
    //得到上传文件的值
    var fileName=document.getElementById("FileUpLoad1").value;
    
    //返回String对象中子字符串最后出现的位置.
    var seat=fileName.lastIndexOf(".");
   
    //返回位于String对象中指定位置的子字符串并转换为小写.
    var extension=fileName.substring(seat).toLowerCase();
   
    var allowed=[".jpg",".gif",".png",".bmp",".jpeg",".ico"];
    for(var i=0;i<allowed.length;i++){
        if(!(allowed[i]!=extension)){
            return true;
        }
    }
    alert("不支持"+extension+"格式");
    return false;
  }
</script>
</head>
<body>
    <form id="form1" runat="server">
      
       <div>
         <table style=" margin:0 auto; text-align:left; width:666px; border:1px solid #0099FF" rules="all">
           <tr>
             <td colspan="4" align="center" style="font-size:x-large; background-color:#33CCFF">产品信息</td>
           </tr>
           
           <tr>
             <td style="width:86px" >产品分类</td>
             <td colspan="3">
               <asp:DropDownList id="bigType" Width="120px" runat="server"  AutoPostBack="True"
                     onselectedindexchanged="bigType_SelectedIndexChanged"></asp:DropDownList>
               &nbsp;&nbsp;&nbsp;
               <asp:DropDownList ID="smallType" Width="120px"  runat="server"></asp:DropDownList>
             </td>
           </tr>
           <tr>
             <td>产品名称</td>
             <td>
                <asp:TextBox ID="bookName" runat="server" Width="165px"></asp:TextBox>
                 *<asp:RequiredFieldValidator runat="server" ControlToValidate="bookName" ErrorMessage="必填项" Display="Dynamic"></asp:RequiredFieldValidator>
             </td>
             <td>进货量</td>
             <td>
               <asp:TextBox ID="importCount" runat="server" Width="165px"></asp:TextBox>
               *<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="price" ErrorMessage="必填项" Display="Dynamic"></asp:RequiredFieldValidator>
             </td>
           </tr>
           <tr>
             <td >原价</td>
             <td >
               <asp:TextBox ID="price" runat="server" Width="165px"></asp:TextBox>
                 *<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="price" ErrorMessage="必填项" Display="Dynamic"></asp:RequiredFieldValidator>
             </td>
             <td>折扣</td>
             <td>
               <asp:TextBox ID="discount" runat="server" Width="165px"></asp:TextBox>
             </td>
           </tr>
           <tr>
             <td>库存量</td>
             <td>
               <asp:TextBox ID="count" runat="server" Width="165px"></asp:TextBox>
                 *<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
               ControlToValidate="count" ErrorMessage="必填项" Display="Dynamic"></asp:RequiredFieldValidator>
             </td>
             <td>状态</td>
             <td>
               <asp:RadioButton Text="在售" ID="onShow" Checked="true" runat="server" />
               <asp:RadioButton Text="下架" ID="onHide" runat="server" />
             </td>
           </tr>
           <tr>
             <td >封面图片</td>
             <td  colspan="3">
               <asp:TextBox ID="UpfileName" runat="server" Width="165px"></asp:TextBox>
               <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="UpfileName" ErrorMessage="必填项" Display="Dynamic"></asp:RequiredFieldValidator>
               <asp:FileUpload ID="FileUpLoad1" runat="server" onchange="UpfileName.value=this.value" enableviewstate="True" />
             </td>
           </tr>
           <tr>
             <td ></td>
             <td  colspan="3">
               <asp:Button ID="Button2"  Text="文件上传"  OnClientClick="return checkType()" runat="server" onclick="Button2_Click" />
               <asp:Label ID="lblMessage" runat="server"></asp:Label>  
             </td>
           </tr>
           <tr>
             <td >作者</td>
             <td colspan="3">
               <asp:TextBox ID="author" runat="server" Width="165px"></asp:TextBox>
             </td>
           </tr>
           <tr>
             <td >出版社</td>
             <td colspan="3">
               <asp:TextBox ID="publisher" runat="server" Width="165px"></asp:TextBox>
             </td>
           </tr>
           <tr>
             <td >详细参数</td>
             <td colspan="3">
             <asp:TextBox ID="detail" TextMode="MultiLine" Height="140px" Width="500px" 
                     runat="server"></asp:TextBox></td>
           </tr>
           <tr>
             <td colspan="4" align="center">
               <asp:Button ID="insert"  Text="确定添加" runat="server" onclick="Unnamed1_Click" /> 
               &nbsp;&nbsp;&nbsp;&nbsp; 
               <asp:Button ID="Button1" Width="78px"  Text="修改" runat="server" 
                     onclick="Button1_Click"  /> 
             </td>
           </tr>
           <tr>
             <td colspan="4"><input type="button" onclick="javascript:window.history.go(-1);"value="返回上一页"/> </td>
           </tr>
         </table>
       </div>
    </form>
</body>
</html>
